package com.hnkywl.sts.action.cwgl.kmys;

import com.hnkywl.sts.entity.cwgl.kmys.Ljkmdmys;
import com.hnkywl.sts.service.cwgl.kmys.LjkmdmysService;
import net.ruixin.web.struts2.SimpleActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created with IntelliJ IDEA.
 * User: ccr
 * Date: 13-5-13
 * Time: 上午11:37
 * To change this template use File | Settings | File Templates.
 */
@Namespace("/cwgl/kmys/ljkmdmys")
public class LjkmdmysAction extends SimpleActionSupport {
    //分页组件 起始位置
    private int page;
    //分页组件 页面大小
    private int rows = 10;
    //内部公司Id
    private Long nbgsId;
    //企业机构Id
    private Long qyjgId;
    //科目代码
    private String kmdm;
    //科目代码的类型 0供应商 1客户
    private Integer type;

    private Ljkmdmys ljkmdmys;

    private LjkmdmysService ljkmdmysService;

    private String gysfzhsdm;

    private String khfzhsdm;

    private String qyjgQc;

    @Action("ljkmdmysList")
    public void ljkmdmysList() {
        renderJson(ljkmdmysService.findLjkmdmysList(qyjgQc, gysfzhsdm, khfzhsdm, page, rows));
    }

    @Action("save")
    public void saveLjkmdmys() {
        try {
            Long id = ljkmdmysService.save(ljkmdmys);
            renderJson("{\"statusCode\":200,\"id\":"+id+"}");
        } catch (Exception e) {
            e.printStackTrace();
            renderJson("{\"statusCode\":300,\"message\":\"" + e.getMessage() + "\"}");
        }
    }

    @Action("findKmdm")
    public void findKmdm() {
        renderJson(ljkmdmysService.findKmdm(nbgsId, type));
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public String getGysfzhsdm() {
        return gysfzhsdm;
    }

    public void setGysfzhsdm(String gysfzhsdm) {
        this.gysfzhsdm = gysfzhsdm;
    }

    public String getKhfzhsdm() {
        return khfzhsdm;
    }

    public void setKhfzhsdm(String khfzhsdm) {
        this.khfzhsdm = khfzhsdm;
    }

    public int getRows() {
        return rows;
    }

    public String getQyjgQc() {
        return qyjgQc;
    }

    public void setQyjgQc(String qyjgQc) {
        this.qyjgQc = qyjgQc;
    }

    public void setRows(int rows) {
        this.rows = rows;
    }

    public Long getNbgsId() {
        return nbgsId;
    }

    public void setNbgsId(Long nbgsId) {
        this.nbgsId = nbgsId;
    }

    public Long getQyjgId() {
        return qyjgId;
    }

    public void setQyjgId(Long qyjgId) {
        this.qyjgId = qyjgId;
    }

    public String getKmdm() {
        return kmdm;
    }

    public void setKmdm(String kmdm) {
        this.kmdm = kmdm;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Ljkmdmys getLjkmdmys() {
        return ljkmdmys;
    }

    public void setLjkmdmys(Ljkmdmys ljkmdmys) {
        this.ljkmdmys = ljkmdmys;
    }

    public LjkmdmysService getLjkmdmysService() {
        return ljkmdmysService;
    }

    @Autowired
    public void setLjkmdmysService(LjkmdmysService ljkmdmysService) {
        this.ljkmdmysService = ljkmdmysService;
    }
}
